<?php
/*
	积分排行
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['list']=array();
	$return['credit_types']=credit_types();
	unset($return['credit_types']['2']);
	$return['params']['type']=$_RQ['type']?:1;
	set_html('title','积分排行榜');
	exi($return);
}
// 获取排名数据
if($_RQ['op']=='getlist'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$type=intval($_RQ['type'])?:1;
	$return['params']['type']=$type;
	$params['credit'.$type.' >']=0;
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('core_members',$params,array($pindex,$psize),$total,array('id','credit'.$type,'nickname','avatar'),'','credit'.$type.' desc');
	$credit_types=credit_types();
	foreach($list as &$item){
		$item['fee']=$item['credit'.$type];
		$item['typetitle']=$credit_types[$type];
	}
	$return['list']=$list;
	exi($return);
}
?>